package com.egreen.alipay.config;

import com.alipay.api.CertAlipayRequest;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;


@Component
public class AlipayConfig {

    @Value("${alipay.call_back}")
    private static String notifyUrl;

    public static CertAlipayRequest getCertAlipayRequest() {
        CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
        // 设置网关地址
        certAlipayRequest.setServerUrl("https://openapi.alipaydev.com/gateway.do");
        // 设置应用Id
        certAlipayRequest.setAppId("2021000120697558");
        // 设置应用私钥
        certAlipayRequest.setPrivateKey("MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCZjm0HobXmEn9UpjyaxyeRZW6YdxWkB5oHarhDbAy/BQXhZkRgFfPS2hrNiMovk4Bd1eqC+sZhvbqbU8pwfu9MjAnN/cH72ZDRcJKMXJ3cka4t1Bf0l6BSof0cUuqosx6SHOWLm/k1XmRHP7Ra1u5G9vhXLbeJbhtDh8c8TECKBRAYDHc9FiO/j4FKUo/5SbrS/vv72DcU+xuOCVLKISs9tZ1b0mpz4Wqfj5KKeIjD5AN3bDjPkA1zeX22v2d70EsgaSTaSNrDQmYezF4v3StcKDcDHVS8z1TCh5ckRJVaP3qgJRpB5hXuda5MKM1rpzHotlvHxvxlHobqnPsQ25BPAgMBAAECggEAGkjI3O+PRUyRQxoZcZz5Zufn4G0x5Rvv/6kC1XefTus7MHPi7FeVntf6kogBo9cpt+Yv+C+Y2Y4ybPgQxOTVbVLjMsFm/QcmxNLyItiPpPvCxtFxMErsBHj57Gk9BZdzeis8F4OhSsNXguKiqpHzw23u4G1Q51NTk2Ggdu/OdFFZqHtbUKECrcFvtofkq86DZnKIagebQNxaqAHAS7ee7hMXTUOzcp/1bcbxBhCstB0+S6p9701nRin4ZRC7BvriFRR9iuiikRQX2Z9rE063v1fTaUOCbsdknAdtgzU5dYm/3wi0h6SphT0RRHpfCSSIysYcfTwpmkGI/KM/V4jVgQKBgQDIb9/QAFfvWZblFNwECy4zsbX6wLVjahhe+uCrDfj5NIlVs7L5lpfLqOMxI9Zp/ttOUGa1eki8Vb9+EhmRKqrC5DzNESWnnrZtJWE71kvN1uKOVFlBcueWIph4KvXGUtDOI8P7Afufi8XVIV+nGZGFsyKkLqmxQEg7e1Bb/OG8oQKBgQDEH6Ok0ZIV8DcDcwqrbeAHuWhuhzgQ89/fTKJfZ/89orVmRhAuOKDuSyVylaZ781CsjRoyjakFXK7CGHV0puhwuxZrykZDlH0p6Gk/OVmdGNbHpeP8O8KyucQXkMX2Q0kf8IW8bdldvd00L364baleRTYULD71GecnSH/JDMK27wKBgQCD5ttqjk9P+60JZAjFwHXPHwua0GaN3avcFUz0RGWr2Z7m/zKwfSG3rJSWKfdYGZdImjB9DNQA3Iz/8flRRrrJNlmsubQF8rQqb4blUcjg1KCS+X8jSvKMIogjzGGg+a7feTnnXQ6xl9HAyA2icXkKezA4y1xwgNUID8Z6QphrAQKBgDnaK2d++lzGUzQNR2RyMNeWdZvE/2Dgz3ULIgqKntwLlv7oQ/WedrpUKGO4iTee+nkr1kJ7TxRp1pMiq+MRKRe32FFLhZaBwroN+J3RyQFyRkj2Ql4xMqmN6q4Y4oxWJMfrJ0gCD1B7pTizmenFT2SjfeRNePTMA0evNyKTRQy5AoGBAJ7aHKRTMtC0d1fMXZYTAeR6WTqlNSn2vV1eMUpGObtyb99uuWG1XcP+3jndc880k77AQ5MYkdzS28zlMJLh5yDzEEMV4tHA36bGlh2MhjXLebULMaHid/3huCTWEYV7KeTvaHx4z0qJaXFOvWLNQKSRmML+T3giXu7MeaOPpHDi");
        // 设置请求格式，固定值json
        certAlipayRequest.setFormat("json");
        // 设置字符集
        certAlipayRequest.setCharset("UTF-8");
        // 设置签名类型
        certAlipayRequest.setSignType("RSA2");
        // 设置应用公钥证书路径
        certAlipayRequest.setCertPath("C:\\Users\\Volcan\\Desktop\\E-green-recycling\\alipay\\src\\main\\resources\\alipayCert\\appCertPublicKey_2021000120697558.crt");
        // 设置支付宝公钥证书路径
        certAlipayRequest.setAlipayPublicCertPath("C:\\Users\\Volcan\\Desktop\\E-green-recycling\\alipay\\src\\main\\resources\\alipayCert\\alipayCertPublicKey_RSA2.crt");
        // 设置支付宝根证书路径
        certAlipayRequest.setRootCertPath("C:\\Users\\Volcan\\Desktop\\E-green-recycling\\alipay\\src\\main\\resources\\alipayCert\\alipayRootCert.crt");



        return certAlipayRequest;
    }
}
